from django.shortcuts import render
import os
from django.conf import settings

def generate_index_html():
    # 1.查询数据
    context = {

    }

    # 2.渲染页面
    response = render(None, 'index.html', context=context)
    html_str = response.content.decode()

    # 3.写文件
    with open(os.path.join(settings.BASE_DIR, 'static/index.html'), 'w') as f:
        f.write(html_str)


